home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / RGASM.RAR / ASMCODE.EXE / CHAPT8 / PG0801.ASM < prev    next >
Encoding:
Assembly Source File  |  1993-05-10  |  4.1 KB  |  90 lines

  1. ;***********************************************************************
  2. ;
  3. ;  Program PG0801 ( Chapter 8 )
  4. ;
  5. ;  Output text onto the screen
  6. ;
  7. ;  Author: A.I.Sopin, VSU, Voronezh, 1992
  8. ;
  9. ;  The technique of writing into video buffer is used (procedure WRCHAR)
  10. ;
  11. ;***********************************************************************
  12. .model  small
  13.  
  14. EXTRN   VIDTYP : FAR, PUTSTR : FAR, WRCHAR : FAR
  15.  
  16. ;----------------------------------------------------------
  17. .stack
  18. .data
  19. VIDBUF  DW      0
  20. TEXT0   DB      ' Output to Screen  (Low Level).  Press any key...', 0
  21. TEXT1   DB      ' Video adapter type = '
  22. VTypeS  DB      'X'
  23.     DB      '   MODE = '
  24. VModeS  DB      'X'
  25.     DB      '    Press any key...', 0
  26. VT      DB      0
  27. VMODE   DB      0
  28. ;----------------------------------------------------------
  29. .code
  30. .startup
  31.     mov     ah,0Fh                  ;  function 0Fh - get video mode
  32.     int     10h                     ;  BIOS video service call
  33.     mov     VMODE,al                ;  save original video mode
  34.     Call    VIDTYP                  ;  determine video adapter type
  35.     mov     VIDBUF,dx               ;  video buffer address
  36.     mov     VT,al                   ;  save video adapter type
  37.     xor     ah,ah                   ;  function 00h - set video mode
  38.     mov     al,2                    ;  80x25  B & W
  39.     int     10h                     ;  BIOS video service call
  40. ;  Hide cursor before output
  41.     mov     dx,1950h                ;  cursor position oyside screen
  42.     xor     bh,bh                   ;  video page 0
  43.     mov     ah,2                    ;  function 02h - set cursor
  44.     int     10h                     ;  BIOS video service call
  45.     mov     cx,80                   ;  max length of string
  46.     mov     ah,07h                  ;  attribute byte
  47.     lea     si,TEXT0                ;  start address of text for output
  48.     xor     dx,dx                   ;  output from position 0, 0
  49.     xor     bh,bh                   ;  video page 0
  50.     Call    PUTSTR                  ;  output prompt
  51.     xor     ah,ah                   ;  function 00h - get key
  52.     int     16h                     ;  BIOS keyboard service call
  53. ;  determine and report the video adapter type
  54.     mov     al,VT                   ;
  55.     mov     VtypeS,al               ;  Video Adapter Type
  56.     or      VtypeS,30h              ;  Bin ---> ASCII
  57.     mov     ah,0Fh                  ;  function 0Fh - get video mode
  58.     int     10h                     ;  BIOS video service call
  59.     mov     VModeS,al               ;  Video Mode
  60.     or      VModeS,30h              ;  Bin ---> ASCII
  61.     mov     cx,80                   ;  max length of string
  62.     mov     ah,07h                  ;  attribute byte - white on black
  63.     lea     si,TEXT1                ;  start address of text for output
  64.     xor     bh,bh                   ;  video page 0
  65.     mov     dx,0100h                ;  output from position 0, 1
  66.     Call    PUTSTR                  ;  output adapter type
  67.     xor     ah,ah                   ;  function 00h - get key
  68.     int     16h                     ;  BIOS keyboard service call
  69. ;-------------------------------------------------------------------
  70. ;  Output text onto screen
  71.     xor     dx,dx                   ;  output from position 0, 0
  72.     mov     ah,07h                  ;  attribute byte - white on black
  73.     mov     al,'E'                  ;  character to be output
  74.     xor     bx,bx                   ;  video page 0
  75.     mov     cx,1920                 ;  output 24 lines
  76.     mov     bl,VT                   ;  BL - video adapter type
  77.     mov     es,VIDBUF               ;
  78.     Call    WRCHAR                  ;  output 1920 characters
  79.     xor     ah,ah                   ;  function 00h - get key
  80.     int     16h                     ;  BIOS keyboard service call
  81. ;-------------------------------------------------------------------
  82. ;  Finish the program and return to MS-DOS
  83. Exit:   mov     al,VMODE                ;  AL - original video mode
  84.     xor     ah,ah                   ;  function 00h - set video mode
  85.     int     10h                     ;  BIOS video service call
  86.     mov     ax,4C00h                ;  Return Code =0
  87.     int     21h                     ;  DOS service call
  88. ;-------------------------------------------------------------------
  89.     END
  90.